export const HOME = 'HOME';
export const HOME_RETURN = 'HOME_RETURN';

export function getHome() {
    return (dispatch, getState) => {
        dispatch({type: HOME});
        var request = new XMLHttpRequest();
        request.onreadystatechange = () => {
            if (request.readyState === 4) {
                var res = request.response;
                dispatch({type: HOME_RETURN, payload: res});
            }
        };
        request.open('GET', '/api/home');
        request.responseType = 'json';
        request.send(null);
    }
}

